<?php

namespace App\Admin\Extensions;

use App\Model\Withdraw;
use Encore\Admin\Admin;

class WithdrawVerify extends BaseAction
{
    protected function render()
    {
        Admin::script($this->script($this->actionUrl));
        // $sandbtn = $this->buildButton('ok', '杉德提现', ['id' => $this->id, 'status' => Withdraw::STATUS_OK, 'extra' => 'sand']);
        $okbtn = $this->buildButton('ok', '云账户提现', ['id' => $this->id, 'status' => Withdraw::STATUS_OK, 'extra' => 'yzh']);
        $failbtn = $this->buildButton('fail', '不允许提现', ['id' => $this->id, 'status' => Withdraw::STATUS_FAIL]);
        $backbtn = $this->buildButton('fail', '退还金币', ['id' => $this->id, 'status' => Withdraw::STATUS_FAIL, 'action' => 'yzh_err_back']);
        $str = [];
        if ($this->row->status == Withdraw::STATUS_ING) {
            $str = [$okbtn, $failbtn]; //$wechatbtn, $alipaybtn, $aliBusibtn
            $profile = $this->row->personalProfile ?? '';
            // if ($profile && $profile->bank_card) {
            //     array_unshift($str, $sandbtn);
            // }

            // if ($profile && $profile->alipay_account && $profile->phone) {
            //     array_unshift($str, $mstAlipayBtn);
            // }
            // if ($profile && $profile->bank_card && $profile->phone) {
            //     array_unshift($str, $mstAlipayBankBtn);
            // }

        } elseif ($this->row->status == Withdraw::STATUS_YZH_ERR) {
            $str = [$backbtn];
        }
        return implode('<br/><br/>', $str);
    }
}
